@extends('app')

@section('content')
<link href="{{ asset('/css/spinners.css') }}" rel="stylesheet">

<div id="grid" class="grid" style="position: fixed;z-index: 1000;left:50%;display: none;">
    <div class="cell">
        <div class="card">
            <span class="throbber-loader">Loading…</span>
        </div>
    </div>
</div>
<ul class="nav nav-tabs">
    <li class="active"><a href="#">列表</a></li>
</ul>

<div class="panel panel-default mt20">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
          <thead>
            <tr>
              <th>编号</th>
              <th>标题</th>
              <th>作者</th>
              <th>审核</th>
              <th>首页推荐</th>
              <th>所属学院</th>
              <th>发布时间</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
          @foreach($teaches as $res)
            <tr id="news_{{ $res->id }}">
              <td>{{ $res->id }}</td>
              <td><a href="{{ url('/admin/teaches/index/chapter/'.$res->id) }}">{{ str_limit($res->name,30) }} </a></td>
              <td>{{ $res->user->name }}</td>
              <td>
                @if($res->is_validate == 1)
                    <span class="label label-success arrowed">
                        已审核通过
                    </span>
                @elseif($res->is_validate == 2)
                    <span class="label label-danger arrowed-in">审核不通过</span>
                @else
                    <span class="label label-warning" onclick="teachesModel('admin/teaches/index',{{ $res->id }})">
    					<i class="icon-warning-sign bigger-120"></i>
    					未审核
    				</span>
                @endif
              </td>
              <td id="disabled">
                @if($res->is_recommond == 1)
                 <span class="glyphicon glyphicon-ok-circle  green-remove"
                    onclick="changeUserStatus('/admin/teaches/index/recommond','{{ $res->id }}', '{{ $res->is_recommond }}', '{{ csrf_token() }}')"></span>
                @else
                <span class="glyphicon glyphicon-remove-circle red-ok"
                          onclick="changeUserStatus('/admin/teaches/index/recommond','{{ $res->id }}', '{{ $res->is_recommond }}', '{{ csrf_token() }}')"></span>
                @endif
              </td>
              <td>
                {{ $res->education }}
              </td>
              <td>{{ $res->updated_at}}</td>
              <td>
                <a href="{{ url('/admin/teaches/index/chapter/'.$res->id) }}">章节列表</a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="{{ url('/admin/teaches/index/'.$res->id.'/edit') }}"><i class="glyphicon glyphicon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="javascript:void(0);" onclick="deleteSource('admin/teaches/index','{{$res->id}}','{{ csrf_token() }}')"><i class="glyphicon glyphicon-remove-sign"></i></a>
             </td>
            </tr>
          @endforeach
          </tbody>
        </table>
    </div>
</div>
<div>{!! $teaches->render() !!} </div>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">选择添加文章类型</h4>
      </div>
      <div class="modal-body">
        <div class="row">
            <div class="col-md-3  col-md-offset-2">
                <a href="{{ url('/admin/teaches/index/create?mod=jyan') }}" ><i class="glyphicon glyphicon-plus"></i>分步教程</a>
            </div>
            <div class="col-md-3">
                <a href="{{ url('/admin/teaches/index/create?mod=video') }}" ><i class="glyphicon glyphicon-plus"></i>视频教程</a>
            </div>
            <div class="col-md-3">
                <a href="{{ url('/admin/teaches/index/create?mod=office') }}" ><i class="glyphicon glyphicon-plus"></i>OFFICE教程</a>
            </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" id="submittags" data-dismiss="modal">确定</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>  
<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">文章审核</h4>
      </div>
      <div class="modal-body">
            <form id='validated'>
                <table class="table table-striped" id="showinfos">
                </table>
            </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-info" id="submittags" data-dismiss="modal" onclick="to_validate('/admin/teaches/index/validate','{{ csrf_token() }}')">确定</button>
        <button type="button" class="btn" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
@endsection
